<template>
		<view >
			<uni-table  :loading="loading" border stripe   >
				<uni-tr>
					<uni-th width="150" align="center">分类</uni-th>
					<uni-th width="150" align="center">{{searchResult[0]['category']}}</uni-th>
				</uni-tr>
				<uni-tr>
					<uni-th width="150" align="center">状态</uni-th>
					<uni-th width="150" align="center">{{searchResult[0]['state']}}</uni-th>
				</uni-tr>
				<uni-tr>
					<uni-th width="150" align="center">消耗比</uni-th>
					<uni-th width="150" align="center">{{searchResult[0]['ratio']}}</uni-th>
				</uni-tr>
			</uni-table>
		</view>
</template>

<script>
export default {
    data() {
        return {
			searchResult: [],
			searchId:0,
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (options) {
		this.searchId=options.id
		var urlstr = 'exerciseInfo/get/id=' + this.searchId
		this.$https({
			url: this.$baseUrl + urlstr,
			success: (res) => {
				if (res.statusCode == 200) {
						this.searchResult.push({
							'category': res.data['data'].category,
							'id': res.data['data'].id,
							'name': res.data['data'].name,
							'pic': res.data['data'].pic,
							'state': res.data['data'].state,
							'ratio': res.data['data'].ratio,
							'version': res.data['data'].version,
					})
				} else {
					uni.showToast({
						title: res.data.errorCode,
						icon: 'error',
					})
				}
			},
		
			fail: (e) => {
				console.log(e)
				uni.showToast({
					title: '搜索失败',
					icon: 'error',
				})
			}
		});
	},
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    methods: {
    }	
};
</script>
<style>
@import './composition.css';
</style>
